package com.china.springServer.listener;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @fileName: KafkaConsumer
 * @author: LmR
 * @createDate: 2023/10/21 14:46
 * @Desc:
 */
@Component
public class KafkaConsumer {
    @KafkaListener(topics = {"topic-test"})
    public void onMessage(ConsumerRecord<String, String> record) {
        System.out.println("listener result......");
        System.out.println("消费分区:" + record.topic() + "-" + record.partition() + "-" + record.key() + "-" + record.value());
    }
}
